<?php

/* @var $this \yii\web\View */
/* @var $content string */
use yii\helpers\Url;
use yii\helpers\Html;
?>
<div style="height:5px"></div>
<div class="btn-group" style="float: right;">
    <a href="<?=Url::toRoute(['menu/addmenu']);?>" class="btn btn-warning">添加菜单</a>
</div>
<div style="height:50px"></div>

<form method="post" action="">
    <input type="hidden" name="<?php echo Yii::$app->request->csrfParam;?>" value="<?php echo Yii::$app->request->getCsrfToken();?>"> 
    <table id="dnd-example" cellspacing="0" class="table table-striped table-hover">
        <tbody>
            <tr>
                <th>排序</th>
                <th>id</th>
                <th>菜单名称</th>
                <th>m</th>
                <th>c</th>
                <th>a</th>
                <th>操作</th>
            </tr>
            <?php echo $categorys;?>
        </tbody>
    </table>
    <input type="submit" name="submit" class="btn btn-info" value="排序">
</form>
<?php $this->beginBlock('delete') ?>

function del(id)
{
    layer.confirm(
        '确定删除该菜单？',
        {icon: 5, title:'删除'},
        function(index){
            $.get("<?=Url::toRoute(['menu/deletemenu'])?>", {id:id},
                function(data){
                if(data.status == -1){
                    window.location.reload();
            }
        layer.msg(data.msg);
        });
        layer.close(index);
    });
}


<?php $this->endBlock() ?>
<?php $this->registerJs($this->blocks['delete'], \yii\web\View::POS_END);?>										